package com.tools.common.enums;

import lombok.Getter;

/**
 * 响应状态码枚举
 */
@Getter
public enum ResultCode {


    // 成功状态码
    SUCCESS(200, "操作成功"),
    ERROR(100, "操作失败"),



    // 客户端错误
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "权限不足"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不支持"),

    // 服务器错误
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务暂不可用"),

    // 业务错误
    BUSINESS_ERROR(10001, "业务逻辑错误"),
    DATA_EXIST(10002, "数据已存在"),
    DATA_NOT_EXIST(10003, "数据不存在"),

    // 数据操作错误
    DATA_UPDATE_ERROR(10005, "数据更新失败"),
    DATA_DEL_ERROR(10006, "数据删除失败"),
    DATA_ADD_ERROR(10004, "数据添加失败"),
    DATA_QUERY_ERROR(10007, "数据查询失败"),
    DATA_QUERY_LIST_ERROR(10008, "数据查询列表失败"),
    DATA_QUERY_PAGE_ERROR(10009, "数据查询分页失败"),
    DATA_QUERY_PAGE_SIZE_ERROR(10010, "数据查询分页大小错误"),
    DATA_QUERY_PAGE_NUM_ERROR(10011, "数据查询分页页码错误"),

    //登录错误
    LOGIN_ERROR(10012, "登录失败"),
    LOGIN_PASSWORD_ERROR(10013, "登录密码错误"),
    LOGIN_ACCOUNT_ERROR(10014, "登录账号错误"),
    LOGIN_ACCOUNT_DISABLE(10015, "登录账号已禁用"),
    LOGIN_ACCOUNT_LOCK(10016, "登录账号已锁定"),
    LOGIN_ACCOUNT_EXPIRE(10017, "登录账号已过期"),
    LOGIN_ACCOUNT_NOT_REGISTER(10018, "登录账号未注册"),
    LOGIN_ACCOUNT_NOT_ENABLE(10019, "登录账号未启用"),

    //退出登录
    LOGOUT_SUCCESS(10020, "退出登录成功"),
    LOGOUT_ERROR(10021, "退出登录失败"),

    //重置密码
    DATA_RESET_PASSWORD_ERROR(10022, "重置密码失败"),
    DATA_RESET_PASSWORD_SUCCESS(10023, "重置密码成功"),
    DATA_UPDATE_PASSWORD_ERROR(10024, "修改密码失败"),
    DATA_UPDATE_PASSWORD_SUCCESS(10025, "修改密码成功"),

    // 账号错误
    USERNAME_EXIST(10026, "账号已存在"),
    PHONE_EXIST(10027, "手机号已存在"),
    EMAIL_EXIST(10028, "邮箱已存在"),
    NICKNAME_EXIST(10029, "昵称已存在"),
    OLD_PASSWORD_ERROR(10030, "旧密码错误"),
    NEW_PASSWORD_ERROR(10031, "新密码错误"),
    PASSWORD_ERROR(10032, "密码错误"),
    PASSWORD_SUCCESS(10033, "密码成功"),
    PASSWORD_ERROR_COUNT(10034, "密码错误次数超过限制"),
    PASSWORD_ERROR_COUNT_RESET(10035, "密码错误次数重置"),
    PASSWORD_ERROR_COUNT_RESET_SUCCESS(10036, "密码错误次数重置成功"),
    PASSWORD_ERROR_COUNT_RESET_ERROR(10037, "密码错误次数重置失败"),

    // 用户错误
    USER_NOT_FOUND(10038, "用户不存在"),
    USER_DISABLE(10039, "用户已禁用"),
    USER_LOCK(10040, "用户已锁定"),
    USER_EXPIRE(10041, "用户已过期"),
    USER_NOT_ENABLE(10042, "用户未启用"),

    TOKEN_INVALID(10043, "token无效"),
    TOKEN_EXPIRE(10044, "token已过期"),
    TOKEN_NOT_FOUND(10045, "token不存在"),
    TOKEN_ERROR(10046, "token错误"),
    TOKEN_SUCCESS(10047, "token成功"),
    TOKEN_CREATE_SUCCESS(10048, "token创建成功"),
    TOKEN_CREATE_ERROR(10049, "token创建失败"),
    TOKEN_REFRESH_SUCCESS(10050, "token刷新成功"),
    TOKEN_REFRESH_ERROR(10051, "token刷新失败"),
    TOKEN_REVOKE_SUCCESS(10052, "token失效成功"),
    TOKEN_REVOKE_ERROR(10053, "token失效失败"),
    TOKEN_NOT_SUPPORT(10054, "token不支持"),
    TOKEN_NOT_SUPPORT_ERROR(10055, "token不支持错误"),
    TOKEN_NOT_SUPPORT_REFRESH(10056, "token不支持刷新"),
    TOKEN_NOT_SUPPORT_REFRESH_ERROR(10057, "token不支持刷新错误"),
    TOKEN_NOT_SUPPORT_REVOKE(10058, "token不支持失效"),
    TOKEN_NOT_SUPPORT_REVOKE_ERROR(10059, "token不支持失效错误"),
    TOKEN_NOT_SUPPORT_CREATE(10060, "token不支持创建"),
    TOKEN_NOT_SUPPORT_CREATE_ERROR(10061, "token不支持创建错误"),

    // 密钥错误
    KEY_ERROR(10062, "密钥错误"),
    KEY_SUCCESS(10063, "密钥成功"),
    KEY_NOT_FOUND(10064, "密钥不存在"),
    KEY_DISABLE(10065, "密钥已禁用"),
    KEY_LOCK(10066, "密钥已锁定"),
    KEY_EXPIRE(10067, "密钥已过期"),
    KEY_NOT_ENABLE(10068, "密钥未启用"),
    KEY_LOAD_SUCCESS(10069, "密钥加载成功"),
    KEY_LOAD_ERROR(10070, "密钥加载失败"),
    KEY_GENERATE_SUCCESS(10071, "请先加载或生成密钥"),


    // 许可证错误
    LICENSE_ERROR(10072, "许可证错误"),
    LICENSE_SUCCESS(10073, "许可证成功"),
    LICENSE_NOT_FOUND(10074, "许可证不存在"),
    LICENSE_DISABLE(10075, "许可证已禁用"),
    LICENSE_LOCK(10076, "许可证已锁定"),
    LICENSE_EXPIRE(10077, "许可证已过期"),
    LICENSE_NOT_ENABLE(10078, "许可证未启用"),
    LICENSE_GENERATE_SUCCESS(10079, "许可证生成成功"),
    LICENSE_GENERATE_ERROR(10080, "许可证生成失败"),
    LICENSE_VERIFY_SUCCESS(10081, "许可证验证成功"),
    LICENSE_VERIFY_ERROR(10082, "许可证验证失败"),

    KEY_PUBLIC_ERROR(10083, "公钥错误"),
    KEY_PRIVATE_ERROR(10084, "私钥错误"),


    WORKFLOW_ERROR(10085, "工作流程异常"),
    WORKFLOW_ERROR_WORKFLOW_NOT_FOUND(10086, "工作流程不存在"),
    WORKFLOW_ERROR_NODE_NOT_FOUND(10087, "工作流程节点不存在"),
    WORKFLOW_ERROR_NODE_DISABLE(10088, "工作流程节点已禁用"),
    WORKFLOW_ERROR_NODE_DISABLE_ERROR(10089, "工作流程节点已禁用，不能执行"),



    ;
    /**
     * 状态码
     */
    private final int code;

    /**
     * 提示信息
     */
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

}
